/**
 * @Project Name:cn.hoofungson.studio
 * @Package Name:cn.hoofungson.sso.config
 * @Since JDK 1.8
 */
package cn.hoofungson.sso.config;

import cn.hoofungson.sso.interceptor.CorsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Description: Web适配器
 * @Author 胡松 hoofungson@163.com
 * @Date 2017-11-11 0:27
 * @Version V1.0
 */
@Configuration
public class WebAdapter extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //众多的拦截器组成了一个拦截器链
        /**
         * 主要方法说明：
         * addPathPatterns 用于添加拦截规则
         * excludePathPatterns 用户排除拦截
         */
        registry.addInterceptor(new CorsInterceptor()).addPathPatterns("/*");
        super.addInterceptors(registry);
    }
}
